﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ManageSkills.aspx.cs" Inherits="admin_ManageSkills" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div style="margin-left: auto; margin-right:auto; border: solid 2px black; width: 80%">
    <asp:HyperLink ID="HyperLink1" runat="server" 
        NavigateUrl="~/admin/Default.aspx">Return to Administrator Home</asp:HyperLink>
    <asp:LinqDataSource ID="DSCategories" runat="server" 
        ContextTypeName="OpenGivingDataContext" OrderBy="category" 
        TableName="AttributeCategories" EnableInsert="True" EnableUpdate="True">
    </asp:LinqDataSource>
    
    <asp:LinqDataSource ID="DSSkills" runat="server" 
        ContextTypeName="OpenGivingDataContext" EnableInsert="True" EnableUpdate="True" 
        OrderBy="attribute" TableName="Attributes" 
        >
        <WhereParameters>
            <asp:Parameter DefaultValue="0" Name="category_id" Type="Int32" />
        </WhereParameters>
    </asp:LinqDataSource>

    
    <p>
    <asp:Label ID="Label1" Font-Bold="true" runat="server" Text="Categories"></asp:Label><br/>
        <asp:ListView ID="lvCategories" runat="server" DataKeyNames="category_id" 
            DataSourceID="DSCategories" InsertItemPosition="LastItem" 
            onselectedindexchanged="lvCategories_SelectedIndexChanged" 
            oniteminserted="lvCategories_ItemInserted">
            <ItemTemplate>
                <tr style="">
                    <td>
                        <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
                        <asp:Button ID="SelectButton" runat="server" CommandName="Select" Text="Select" />
                    </td>
                    <td>
                        <asp:Label ID="category_idLabel" runat="server" 
                            Text='<%# Eval("category_id") %>' />
                    </td>
                    <td>
                        <asp:Label ID="categoryLabel" runat="server" Text='<%# Eval("category") %>' />
                    </td>
                    <td>
                        <asp:CheckBox ID="isActiveCheckBox" runat="server" 
                            Checked='<%# Eval("isActive") %>' Enabled="false" />
                    </td>
                </tr>
            </ItemTemplate>
            <AlternatingItemTemplate>
                <tr style="">
                    <td>
                        <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
                        <asp:Button ID="SelectButton" runat="server" CommandName="Select" Text="Select" />
                    </td>
                    <td>
                        <asp:Label ID="category_idLabel" runat="server" 
                            Text='<%# Eval("category_id") %>' />
                    </td>
                    <td>
                        <asp:Label ID="categoryLabel" runat="server" Text='<%# Eval("category") %>' />
                    </td>
                    <td>
                        <asp:CheckBox ID="isActiveCheckBox" runat="server" 
                            Checked='<%# Eval("isActive") %>' Enabled="false" />
                    </td>
                </tr>
            </AlternatingItemTemplate>
            <EmptyDataTemplate>
                <table runat="server" style="">
                    <tr>
                        <td>
                            No data was returned.</td>
                    </tr>
                </table>
            </EmptyDataTemplate>
            <InsertItemTemplate>
                <tr style="">
                    <td>
                        <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                            Text="Insert" />
                        <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                            Text="Clear" />
                    </td>
                    <td>
                        &nbsp;</td>
                    <td>
                        <asp:TextBox ID="categoryTextBox" runat="server" 
                            Text='<%# Bind("category") %>' />
                    </td>
                    <td>
                        <asp:CheckBox ID="isActiveCheckBox" runat="server" 
                            Checked="true" />
                    </td>
                </tr>
            </InsertItemTemplate>
            <LayoutTemplate>
                <table runat="server">
                    <tr runat="server">
                        <td runat="server">
                            <table ID="itemPlaceholderContainer" runat="server" border="0" style="">
                                <tr runat="server" style="">
                                    <th runat="server">
                                    </th>
                                    <th runat="server">
                                        ID</th>
                                    <th runat="server" style="width:250px">
                                        Category</th>
                                    <th runat="server">
                                        Active?</th>
                                </tr>
                                <tr ID="itemPlaceholder" runat="server">
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr runat="server">
                        <td runat="server" style="">
                            <asp:DataPager ID="DataPager1" runat="server">
                                <Fields>
                                    <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                                        ShowLastPageButton="True" />
                                </Fields>
                            </asp:DataPager>
                        </td>
                    </tr>
                </table>
            </LayoutTemplate>
            <EditItemTemplate>
                <tr style="">
                    <td>
                        <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                            Text="Update" />
                        <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                            Text="Cancel" />
                    </td>
                    <td>
                        <asp:Label ID="category_idLabel" runat="server" 
                            Text='<%# Eval("category_id") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="categoryTextBox" runat="server" 
                            Text='<%# Bind("category") %>' />
                    </td>
                    <td>
                        <asp:CheckBox ID="isActiveCheckBox" runat="server" 
                            Checked='<%# Bind("isActive") %>' />
                    </td>
                </tr>
            </EditItemTemplate>
            <SelectedItemTemplate>
                <tr style="">
                    <td>
                        <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
                    </td>
                    <td>
                        <asp:Label ID="category_idLabel" runat="server" 
                            Text='<%# Eval("category_id") %>' />
                    </td>
                    <td>
                        <asp:Label ID="categoryLabel" runat="server" Text='<%# Eval("category") %>' />
                    </td>
                    <td>
                        <asp:CheckBox ID="isActiveCheckBox" runat="server" 
                            Checked='<%# Eval("isActive") %>' Enabled="false" />
                    </td>
                </tr>
            </SelectedItemTemplate>
        </asp:ListView>
    </p>


    <p>
    <asp:Label Font-Bold="true" ID="Label2" runat="server" Text="Skills"></asp:Label>
        <asp:ListView ID="lvSkills" runat="server" DataKeyNames="attribute_id" 
            DataSourceID="DSSkills" InsertItemPosition="LastItem" 
            ondatabound="lvSkills_DataBound" oniteminserting="lvSkills_ItemInserting" 
            onitemupdating="lvSkills_ItemUpdating">
            <ItemTemplate>
                <tr style="">
                    <td>
                        <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
                    </td>
                    <td>
                        <asp:Label ID="attribute_idLabel" runat="server" 
                            Text='<%# Eval("attribute_id") %>' />
                    </td>
                    <td>
                        <asp:Label ID="attributeLabel" runat="server" Text='<%# Eval("attribute") %>' />
                    </td>
                    <td>
                        <asp:Label ID="categoryLabel" runat="server" Text='<%# Eval("AttributeCategories.category") %>' />
                    </td>
                </tr>
            </ItemTemplate>
            <AlternatingItemTemplate>
                <tr style="">
                    <td>
                        <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
                    </td>
                    <td>
                        <asp:Label ID="attribute_idLabel" runat="server" 
                            Text='<%# Eval("attribute_id") %>' />
                    </td>
                    <td>
                        <asp:Label ID="attributeLabel" runat="server" 
                            Text='<%# Eval("attribute") %>' />
                    </td>
                    <td>
                        <asp:Label ID="categoryLabel" runat="server" Text='<%# Eval("AttributeCategories.category") %>' />
                    </td>
                </tr>
            </AlternatingItemTemplate>
            <EmptyDataTemplate>
                <table runat="server" style="">
                    <tr>
                        <td>
                            No data was returned.</td>
                    </tr>
                </table>
            </EmptyDataTemplate>
            <InsertItemTemplate>
                <tr style="">
                    <td>
                        <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                            Text="Insert" />
                        <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                            Text="Clear" />
                    </td>
                    <td>
                        &nbsp;</td>
                    <td>
                        <asp:TextBox ID="attributeTextBox" runat="server" 
                            Text='<%# Bind("attribute") %>' />
                    </td>
                    <td>
                        <asp:DropDownList ID="category_idList" runat="server" DataSourceID="DSCategories" DataTextField="category" DataValueField="category_id">
                        </asp:DropDownList>
                    </td>
                </tr>
            </InsertItemTemplate>
            <LayoutTemplate>
                <table runat="server">
                    <tr runat="server">
                        <td runat="server">
                            <table ID="itemPlaceholderContainer" runat="server" border="0" style="">
                                <tr runat="server" style="">
                                    <th runat="server">
                                    </th>
                                    <th runat="server">
                                        ID</th>
                                    <th id="Th1" runat="server" style="width:200px">
                                        Skill Name</th>
                                    <th id="Th2" runat="server" style="width:200px">
                                        Category</th>
                                </tr>
                                <tr ID="itemPlaceholder" runat="server">
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr runat="server">
                        <td runat="server" style="">
                            <asp:DataPager ID="DataPager1" runat="server">
                                <Fields>
                                    <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                                        ShowLastPageButton="True" />
                                </Fields>
                            </asp:DataPager>
                        </td>
                    </tr>
                </table>
            </LayoutTemplate>
            <EditItemTemplate>
                <tr style="">
                    <td>
                        <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                            Text="Update" />
                        <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                            Text="Cancel" />
                    </td>
                    <td>
                        <asp:Label ID="attribute_idLabel1" runat="server" 
                            Text='<%# Eval("attribute_id") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="attributeTextBox" runat="server" 
                            Text='<%# Bind("attribute") %>' />
                    </td>
                    <td>
                        <asp:DropDownList ID="category_idList" runat="server" DataSourceID="DSCategories" DataTextField="category" DataValueField="category_id">
                        </asp:DropDownList>
                        <asp:HiddenField ID="hiddenCatId" runat="server" Value='<%# Bind("category_id") %>' />
                    </td>
                </tr>
            </EditItemTemplate>
            <SelectedItemTemplate>
                <tr style="">
                    <td>
                        <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
                    </td>
                    <td>
                        <asp:Label ID="attribute_idLabel" runat="server" 
                            Text='<%# Eval("attribute_id") %>' />
                    </td>
                    <td>
                        <asp:Label ID="attributeLabel" runat="server" Text='<%# Eval("attribute") %>' />
                    </td>
                    <td>
                        <asp:Label ID="categoryLabel" runat="server" Text='<%# Eval("AttributeCategories.category") %>' />
                    </td>
                </tr>
            </SelectedItemTemplate>
        </asp:ListView>
        <br/>
    </p>
</div>
</asp:Content>

